<template>
  <div class="field-checkbox">
    <template v-if="tableField.fieldVariableValue.codeArrangement <= 2">
      <el-checkbox-group
        v-model="localValue"
        :style="
          tableField.fieldVariableValue.codeArrangement === 2 &&
            'display:grid;grid-template-columns:repeat(' +
              (tableField.fieldVariableValue.number
                ? tableField.fieldVariableValue.number
                : 1) +
              ', 1fr);justify-items:start;gap:.5rem 0;'
        "
      >
        <el-checkbox
          v-for="(item, index) in tableField.databaseCodeValueDTO"
          :label="item.codeValue"
          :key="index"
          :disabled="disabled || readOnly"
          >{{ item.codeDescribe }}</el-checkbox
        >
      </el-checkbox-group>
    </template>
    <template v-else>
      <el-select
        :multiple="true"
        :size="size"
        :clearable="true"
        v-model="localValue"
        placeholder="请选择"
        :disabled="disabled || readOnly"
      >
        <el-option
          v-for="(item, index) in tableField.databaseCodeValueDTO"
          :label="item.codeDescribe"
          :value="item.codeValue"
          :key="index"
        >
        </el-option>
      </el-select>
    </template>
  </div>
</template>

<script>
import Mixins from "./mixins";
export default {
  mixins: [Mixins]
};
</script>

<style lang="scss" scoped>
/deep/ .el-checkbox__label {
  font-size: 0.75rem;
}
</style>